package edu.hrbu.wsdemo.service;

import edu.hrbu.wsdemo.bean.Message;
import edu.hrbu.wsdemo.config.RabbitMQConfig;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author xudengyu
 */
@Service
public class NotificationService {

    @Resource
    private RabbitTemplate rabbitTemplate;

    public void sendNotification(Message message) {
        rabbitTemplate.convertAndSend(
                RabbitMQConfig.EXCHANGE_NAME,
                RabbitMQConfig.QUEUE_NAME,
                message
        );
    }
}
